
//
//  ActivityCollectionViewCell.m
//  ECBBusinessCamp
//
//  Created by rimi on 16/6/29.
//  Copyright © 2016年 邓毕华. All rights reserved.
//

#import "ActivityCollectionViewCell.h"

@implementation ActivityCollectionViewCell

#pragma mark 🌷🌷🌷life cycle🌷🌷🌷
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.borderColor = RGB_COLOR(165, 165, 165, 1).CGColor;
        self.layer.borderWidth = 1;
        
        // 添加视图
        [self addSubview:self.coverImageView];
        [self addSubview:self.titleLabel];
        [self addSubview:self.originatorLabel];
        [self addSubview:self.dateLabel];
        
        // 自动布局
        [_coverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.equalTo(self);
            make.height.equalTo(self).multipliedBy(0.61);
            make.centerX.equalTo(self);
            make.top.equalTo(self);
        }];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.offset(SCREEN_WIDTH * 0.01);
            make.centerY.equalTo(self).multipliedBy(1.4);
        }];
        [_originatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_titleLabel);
            make.centerY.equalTo(self).multipliedBy(1.65);
        }];
        [_dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_titleLabel);
            make.centerY.equalTo(self).multipliedBy(1.85);
        }];
    }
    return self;
}

#pragma mark 🌷🌷🌷getters and setters🌷🌷🌷
- (UIImageView *)coverImageView {
    if (!_coverImageView) {
        _coverImageView = [[UIImageView alloc] init];
    }
    return _coverImageView;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:25];
        _titleLabel.textColor = RGB_COLOR(104, 104, 104, 1);
    }
    return _titleLabel;
}
- (UILabel *)originatorLabel {
    if (!_originatorLabel) {
        _originatorLabel = [[UILabel alloc] init];
        _originatorLabel.textColor = RGB_COLOR(156, 156, 156, 1);
    }
    return _originatorLabel;
}
- (UILabel *)dateLabel {
    if (!_dateLabel) {
        _dateLabel = [[UILabel alloc] init];
        _dateLabel.textColor = RGB_COLOR(156, 156, 156, 1);
    }
    return _dateLabel;
}

@end
